
*This file runs the regressions for Table 1, as well as Figures 3 and A6

*Table 1, Panel A: Y = % Ag, did_multiplegt estimator
*******************************************************************************
*******************************************************************************


*No Controls
*Note: this command also generates Figure 3
did_multiplegt agpct ID	 year post, placebo(2) dynamic(2) trends_nonparam(StateCode) cluster(TOWNSHIP) breps(10) seed(10)   robust_dynamic longdiff_placebo covariances average_effect graphoptions (ytitle(Agriculture (%)) graphregion(color(white))  ysize(15) xtitle(Time to Treatment) xsize(20) yline(0, lpattern(dash) lcolor(gs10)) legend(off) ) 

*off-rez population control
*Note: this command also generates Panel A of Figure A6

did_multiplegt agpct ID	 year post, placebo(2) dynamic(2) trends_nonparam(StateCode) cluster(TOWNSHIP) breps(10) seed(10) controls(offrespop ) robust_dynamic longdiff_placebo covariances average_effect graphoptions (ytitle(Agriculture (%)) graphregion(color(white))  ysize(15) xtitle(Time to Treatment) xsize(20) yline(0, lpattern(dash) lcolor(gs10)) legend(off) )  

*casino control
*Note: this command also generates Panel B of Figure A6
did_multiplegt agpct ID	 year post, placebo(2) dynamic(2) trends_nonparam(StateCode) cluster(TOWNSHIP) breps(10) seed(10) controls(has_casino ) robust_dynamic longdiff_placebo covariances average_effect graphoptions (ytitle(Agriculture (%)) graphregion(color(white))  ysize(15) xtitle(Time to Treatment) xsize(20) yline(0, lpattern(dash) lcolor(gs10)) legend(off) )  

*credit control
*Note: this command also generates Panel C of Figure A6
did_multiplegt agpct ID	 year post, placebo(2) dynamic(2) trends_nonparam(StateCode) cluster(TOWNSHIP) breps(10) seed(10) controls(has_credit ) robust_dynamic longdiff_placebo covariances average_effect graphoptions (ytitle(Agriculture (%)) graphregion(color(white))  ysize(15) xtitle(Time to Treatment) xsize(20) yline(0, lpattern(dash) lcolor(gs10)) legend(off) ) 

*all rez-t controls
*Note: this command also generates Panel D of Figure A6
did_multiplegt agpct ID	 year post, placebo(2) dynamic(2) trends_nonparam(StateCode) cluster(TOWNSHIP) breps(10) seed(10) controls(offrespop has_casino has_credit ) robust_dynamic longdiff_placebo covariances average_effect graphoptions (ytitle(Agriculture (%)) xtitle(Time to Treatment) graphregion(color(white))  ysize(15) xsize(20) xline(-.5) legend(off)) 


*Table 1, Panel B: Y = % Ag, csdid estimator
*******************************************************************************
*******************************************************************************

preserve


eststo clear
*Baseline with no rezxt controls
csdid agpct , ivar(ID) time(t) gvar(TG)  cluster(TOWNSHIP) agg(simple) drimp


*off-rez population
csdid agpct offrespop, ivar(ID) time(t) gvar(TG)  cluster(TOWNSHIP) agg(simple) drimp


*casinos
csdid agpct has_casino, ivar(ID) time(t) gvar(TG)  cluster(TOWNSHIP) agg(simple) drimp


*credit
csdid agpct has_credit, ivar(ID) time(t) gvar(TG)  cluster(TOWNSHIP) agg(simple) drimp


*all rez-t controls
csdid agpct offrespop has_casino has_credit, ivar(ID) time(t) gvar(TG)  cluster(TOWNSHIP) agg(simple) drimp

restore

*Table 1, Panel C: Y = % Ag, twfe estimator
*******************************************************************************
*******************************************************************************
eststo clear
*Baseline with no rezxt controls
reghdfe agpct post , absorb(ID stateXyear START) cluster(TOWNSHIP)
sum agpct if e(sample) ==1
estadd scalar MDV = r(mean)
est sto twfe_ag_1

*off-rez population
reghdfe agpct post offrespop  , absorb(ID stateXyear START) cluster(TOWNSHIP)
sum agpct if e(sample) ==1
estadd scalar MDV = r(mean)
est sto twfe_ag_2

*credit
reghdfe agpct post has_casino  , absorb(ID stateXyear START) cluster(TOWNSHIP)
sum agpct if e(sample) ==1
estadd scalar MDV = r(mean)
est sto twfe_ag_3

* casinos
reghdfe agpct post has_credit , absorb(ID stateXyear START) cluster(TOWNSHIP)
sum agpct if e(sample) ==1
estadd scalar MDV = r(mean)
est sto twfe_ag_4


*all rez-t controls
reghdfe agpct post offrespop has_c* ,  absorb(ID stateXyear START) cluster(TOWNSHIP)
sum agpct if e(sample) ==1
estadd scalar MDV = r(mean)
est sto twfe_ag_5


esttab twfe_ag_1 twfe_ag_2 twfe_ag_3 twfe_ag_4 twfe_ag_5 ,  se(a3) b(a3) star(* 0.1 ** 0.05 *** 0.01) ar2  replace   scalar(N_clust M1 MDV)


